<!DOCTYPE html>
<html>
  <head>
    <style>
      body { -webkit-filter: url('#a'); }
    </style>
    <script src="../resources/run-after-layout-and-paint.js"></script>
    <script>
      function elementCenter(e)
      {
        return {
          x: e.offsetLeft + e.offsetWidth / 2,
          y: e.offsetTop + e.offsetHeight / 2
        }
      }

      function startTest() {
        if (window.testRunner) {
          testRunner.waitUntilDone();
          testRunner.dumpAsText();
        }

        if (window.eventSender) {
          enterButton = document.getElementById('enter');
          var enterButtonCenter = elementCenter(enterButton);
          eventSender.mouseMoveTo(enterButtonCenter.x, enterButtonCenter.y);
          eventSender.mouseDown();
          eventSender.mouseUp();
        }
      }

      function goFullscreen() {
      	document.body.webkitRequestFullScreen();
      	if (window.testRunner)
          runAfterLayoutAndPaint(function() { testRunner.notifyDone(); });
      }

      window.addEventListener('load', startTest, false);
    </script>
  </head>
  <body>
    <p>Click the Fullscreen button to start a manual test. The page should not crash.</p>
    <button id="enter" onclick="goFullscreen()">Fullscreen</button>
  </body>
</html>